const crypto = require('node:crypto');
const cloud = require('@alipay/faas-server-sdk');
const COLLECTION = 'mall_shop_car';
exports.main = async (event, context) => {
    // 初始化
    cloud.init();
    const db = cloud.database();
      //表不存在初始化表
  const res = await cloud.callFunction({
    name: 'mallInitialize',
    data: {
      "collection":COLLECTION
    }
  });
    // 查询 collection 中的 doc 列表，默认返回 100 条
    const docList = await db.collection(COLLECTION).where({
      userId: event.userId
    }).get();
    console.log('当前 collection 中的 doc 列表:', docList);
  return docList;
};